Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repeatFrequency must be accompanied by appropriate byDay/byMonth/byMonthDay values #362

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thill-odi
Copy link

Ensures that:

  1. A repeatFrequency is specified
  2. The repeatFrequency is well-formed according to a limited subset of ISO 8601 duration values
  3. The repeatFrequency value is accompanied by a byDay, byMonth, or byMonthDay values.

@thill-odi thill-odi requested a review from nickevansuk November 5, 2020 10:26
@nickevansuk
Copy link
Contributor

nickevansuk commented Feb 17, 2021

Noting that this came up in a recent conversation which noted a bug in the spec: openactive/modelling-opportunity-data#260, which impacts (3) above. Though it seems to already have been taken into account in the code of this PR (even if it's not obvious from the description of it)!

Copy link
Contributor

@nickevansuk nickevansuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Mone minor suggestion



/*
Ensures that the value given in repeatFrequency is matched by an appropriate byDay, byWeek, or byMonth attribute. Possible values for repeatFrequency are in the first instance P[\d]D, P[\d]W, P[\d]M. In the first instance the repeatFrequency should be paired with a byDay attribute, in the second, byWeek, etc. Note that this test checks for the bare presence of appropriate attributes; there is no semantic checking
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is P[\d]Y also possible?

}
// check frequency is valud
repeatFrequency = repeatFrequency.toLowerCase();
const regexp = /^p\d(d|w|m)$/;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this allow annual repeats?

@lukehesluke
Copy link
Contributor

The rule that monthly schedules must have byMonthDay and not byDay causes this issue: openactive/modelling-opportunity-data#268 that "2nd Thursday of the month" is not representable

@nickevansuk
Copy link
Contributor

Good catch @lukehesluke ! Feel free to request further changes!

@lukehesluke
Copy link
Contributor

@thill-odi I've suggested a possible set of requirements here: openactive/modelling-opportunity-data#260 (comment). Let me know if that looks good or needs tweaking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check repeatFrequency and byDay, byMonth, byMonthDay values are consistent
3 participants